package com.sa.module.uif.pojo;

import static javax.persistence.GenerationType.IDENTITY;

import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;

/**
 * 照片
 * @author huangxin
 *
 */
@MappedSuperclass
public class AbstractPicture {

	private int id;
	private String path;	//照片路径
	private Activity activity;	//活动
	private String description;	//照片附带描述
	private Timestamp time;	//上传时间
	
	public AbstractPicture(int id, String path, Activity activity,
			String describe, Timestamp time) {
		super();
		this.id = id;
		this.path = path;
		this.activity = activity;
		this.description = describe;
		this.time = time;
	}
	
	public AbstractPicture() {
		super();
		// TODO Auto-generated constructor stub
	}
	
	@Id 
	@GeneratedValue(strategy=IDENTITY)	    
	@Column(name="ID", unique=true, nullable=false)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	@Column(name="PATH", nullable=true, length=100)
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "AID", nullable = true)
	public Activity getActivity() {
		return activity;
	}
	public void setActivity(Activity activity) {
		this.activity = activity;
	}
	
	@Column(name="DESCRIPTION", nullable=true, length=100)
	public String getDescription() {
		return description;
	}
	public void setDescription(String describe) {
		this.description = describe;
	}
	
	@Column(name="TIME", nullable=true)
	public Timestamp getTime() {
		return time;
	}
	public void setTime(Timestamp time) {
		this.time = time;
	}
	
	@Override
	public String toString() {
		return "AbstractPicture [id=" + id + ", path=" + path + ", activity="
				+ activity + ", describe=" + description + ", time=" + time + "]";
	}
	
	
	
}
